<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 6.3.0">

  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css" integrity="sha256-Z1K5uhUaJXA7Ll0XrZ/0JhX4lAtZFpT6jkKrEDT0drU=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"example.com","root":"/","images":"/images","scheme":"Muse","darkmode":false,"version":"8.14.1","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":false,"style":null},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":-1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script>

    <meta name="description" content="name 描述 构造器默认值 默认配置validate之后的值 validate重置    autoCommit 自动提交从池中返回的连接 TRUE TRUE –   connectionTimeout 等待来自池的连接的最大毫秒数 SECONDS.toMillis(30) &#x3D; 30000 30000 如果小于250毫秒，则被重置回30秒   idleTimeout 连接允许在池中">
<meta property="og:type" content="article">
<meta property="og:title" content="HikariCP配置信息">
<meta property="og:url" content="http://example.com/2021/08/23/HikariCP%E9%85%8D%E7%BD%AE%E4%BF%A1%E6%81%AF/index.html">
<meta property="og:site_name" content="JsyBlog">
<meta property="og:description" content="name 描述 构造器默认值 默认配置validate之后的值 validate重置    autoCommit 自动提交从池中返回的连接 TRUE TRUE –   connectionTimeout 等待来自池的连接的最大毫秒数 SECONDS.toMillis(30) &#x3D; 30000 30000 如果小于250毫秒，则被重置回30秒   idleTimeout 连接允许在池中">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2021-08-22T16:00:00.000Z">
<meta property="article:modified_time" content="2021-08-23T05:09:22.261Z">
<meta property="article:author" content="SongyangJi">
<meta property="article:tag" content="Spring之整合一切">
<meta name="twitter:card" content="summary">


<link rel="canonical" href="http://example.com/2021/08/23/HikariCP%E9%85%8D%E7%BD%AE%E4%BF%A1%E6%81%AF/">



<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"http://example.com/2021/08/23/HikariCP%E9%85%8D%E7%BD%AE%E4%BF%A1%E6%81%AF/","path":"2021/08/23/HikariCP配置信息/","title":"HikariCP配置信息"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>HikariCP配置信息 | JsyBlog</title>
  








  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">JsyBlog</p>
      <i class="logo-line"></i>
    </a>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li><li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类</a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup"><div class="search-header">
  <span class="search-icon">
    <i class="fa fa-search"></i>
  </span>
  <div class="search-input-container">
    <input autocomplete="off" autocapitalize="off" maxlength="80"
           placeholder="搜索..." spellcheck="false"
           type="search" class="search-input">
  </div>
  <span class="popup-btn-close" role="button">
    <i class="fa fa-times-circle"></i>
  </span>
</div>
<div class="search-result-container no-result">
  <div class="search-result-icon">
    <i class="fa fa-spinner fa-pulse fa-5x"></i>
  </div>
</div>

    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-overview-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <p class="site-author-name" itemprop="name">SongyangJi</p>
  <div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">251</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">45</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">109</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>

        </div>
      </div>
    </div>

    
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="http://example.com/2021/08/23/HikariCP%E9%85%8D%E7%BD%AE%E4%BF%A1%E6%81%AF/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.gif">
      <meta itemprop="name" content="SongyangJi">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="JsyBlog">
      <meta itemprop="description" content="">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="HikariCP配置信息 | JsyBlog">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          HikariCP配置信息
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>
      

      <time title="创建时间：2021-08-23 00:00:00 / 修改时间：13:09:22" itemprop="dateCreated datePublished" datetime="2021-08-23T00:00:00+08:00">2021-08-23</time>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <table>
<thead>
<tr>
<th><strong>name</strong></th>
<th><strong>描述</strong></th>
<th><strong>构造器默认值</strong></th>
<th><strong>默认配置validate之后的值</strong></th>
<th><strong>validate重置</strong></th>
</tr>
</thead>
<tbody><tr>
<td>autoCommit</td>
<td>自动提交从池中返回的连接</td>
<td>TRUE</td>
<td>TRUE</td>
<td>–</td>
</tr>
<tr>
<td>connectionTimeout</td>
<td>等待来自池的连接的最大毫秒数</td>
<td>SECONDS.toMillis(30) &#x3D; 30000</td>
<td>30000</td>
<td>如果小于250毫秒，则被重置回30秒</td>
</tr>
<tr>
<td>idleTimeout</td>
<td>连接允许在池中闲置的最长时间</td>
<td>MINUTES.toMillis(10) &#x3D; 600000</td>
<td>600000</td>
<td>如果idleTimeout+1秒&gt;maxLifetime 且 maxLifetime&gt;0，则会被重置为0（代表永远不会退出）；如果idleTimeout!&#x3D;0且小于10秒，则会被重置为10秒</td>
</tr>
<tr>
<td>maxLifetime</td>
<td>池中连接最长生命周期</td>
<td>MINUTES.toMillis(30) &#x3D; 1800000</td>
<td>1800000</td>
<td>如果不等于0且小于30秒则会被重置回30分钟</td>
</tr>
<tr>
<td>connectionTestQuery</td>
<td>如果您的驱动程序支持JDBC4，我们强烈建议您不要设置此属性</td>
<td>null</td>
<td>null</td>
<td>–</td>
</tr>
<tr>
<td>minimumIdle</td>
<td>池中维护的最小空闲连接数</td>
<td>-1</td>
<td>10</td>
<td>minIdle&lt;0或者minIdle&gt;maxPoolSize,则被重置为maxPoolSize</td>
</tr>
<tr>
<td>maximumPoolSize</td>
<td>池中最大连接数，包括闲置和使用中的连接</td>
<td>-1</td>
<td>10</td>
<td>如果maxPoolSize小于1，则会被重置。当minIdle&lt;&#x3D;0被重置为DEFAULT_POOL_SIZE则为10;如果minIdle&gt;0则重置为minIdle的值</td>
</tr>
<tr>
<td>metricRegistry</td>
<td>该属性允许您指定一个 Codahale &#x2F; Dropwizard MetricRegistry 的实例，供池使用以记录各种指标</td>
<td>null</td>
<td>null</td>
<td>–</td>
</tr>
<tr>
<td>healthCheckRegistry</td>
<td>该属性允许您指定池使用的Codahale &#x2F; Dropwizard HealthCheckRegistry的实例来报告当前健康信息</td>
<td>null</td>
<td>null</td>
<td>–</td>
</tr>
<tr>
<td>poolName</td>
<td>连接池的用户定义名称，主要出现在日志记录和JMX管理控制台中以识别池和池配置</td>
<td>null</td>
<td>HikariPool-1</td>
<td>–</td>
</tr>
<tr>
<td>initializationFailTimeout</td>
<td>如果池无法成功初始化连接，则此属性控制池是否将 fail fast</td>
<td>1</td>
<td>1</td>
<td>–</td>
</tr>
<tr>
<td>isolateInternalQueries</td>
<td>是否在其自己的事务中隔离内部池查询，例如连接活动测试</td>
<td>FALSE</td>
<td>FALSE</td>
<td>–</td>
</tr>
<tr>
<td>allowPoolSuspension</td>
<td>控制池是否可以通过JMX暂停和恢复</td>
<td>FALSE</td>
<td>FALSE</td>
<td>–</td>
</tr>
<tr>
<td>readOnly</td>
<td>从池中获取的连接是否默认处于只读模式</td>
<td>FALSE</td>
<td>FALSE</td>
<td>–</td>
</tr>
<tr>
<td>registerMbeans</td>
<td>是否注册JMX管理Bean（MBeans）</td>
<td>FALSE</td>
<td>FALSE</td>
<td>–</td>
</tr>
<tr>
<td>catalog</td>
<td>为支持 catalog 概念的数据库设置默认 catalog</td>
<td>driver default</td>
<td>null</td>
<td>–</td>
</tr>
<tr>
<td>connectionInitSql</td>
<td>该属性设置一个SQL语句，在将每个新连接创建后，将其添加到池中之前执行该语句。</td>
<td>null</td>
<td>null</td>
<td>–</td>
</tr>
<tr>
<td>driverClassName</td>
<td>HikariCP将尝试通过仅基于jdbcUrl的DriverManager解析驱动程序，但对于一些较旧的驱动程序，还必须指定driverClassName</td>
<td>null</td>
<td>null</td>
<td>–</td>
</tr>
<tr>
<td>transactionIsolation</td>
<td>控制从池返回的连接的默认事务隔离级别</td>
<td>null</td>
<td>null</td>
<td>–</td>
</tr>
<tr>
<td>validationTimeout</td>
<td>连接将被测试活动的最大时间量</td>
<td>SECONDS.toMillis(5) &#x3D; 5000</td>
<td>5000</td>
<td>如果小于250毫秒，则会被重置回5秒</td>
</tr>
<tr>
<td>leakDetectionThreshold</td>
<td>记录消息之前连接可能离开池的时间量，表示可能的连接泄漏</td>
<td>0</td>
<td>0</td>
<td>如果大于0且不是单元测试，则进一步判断：(leakDetectionThreshold &lt; SECONDS.toMillis(2) or (leakDetectionThreshold &gt; maxLifetime &amp;&amp; maxLifetime &gt; 0)，会被重置为0 . 即如果要生效则必须&gt;0，而且不能小于2秒，而且当maxLifetime &gt; 0时不能大于maxLifetime</td>
</tr>
<tr>
<td>dataSource</td>
<td>这个属性允许你直接设置数据源的实例被池包装，而不是让HikariCP通过反射来构造它</td>
<td>null</td>
<td>null</td>
<td>–</td>
</tr>
<tr>
<td>schema</td>
<td>该属性为支持模式概念的数据库设置默认模式</td>
<td>driver default</td>
<td>null</td>
<td>–</td>
</tr>
<tr>
<td>threadFactory</td>
<td>此属性允许您设置将用于创建池使用的所有线程的java.util.concurrent.ThreadFactory的实例。</td>
<td>null</td>
<td>null</td>
<td>–</td>
</tr>
<tr>
<td>scheduledExecutor</td>
<td>此属性允许您设置将用于各种内部计划任务的java.util.concurrent.ScheduledExecutorService实例</td>
<td>null</td>
<td>null</td>
<td>–</td>
</tr>
</tbody></table>
<blockquote>
<p> <a target="_blank" rel="noopener" href="https://github.com/brettwooldridge/HikariCP">HikariCP on github</a></p>
</blockquote>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/Spring%E4%B9%8B%E6%95%B4%E5%90%88%E4%B8%80%E5%88%87/" rel="tag"># Spring之整合一切</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2021/08/08/MyBatis%E6%BA%90%E7%A0%81%E5%89%96%E6%9E%90%20%E2%80%94%E2%80%94%20mapping-%E5%8C%85%E7%9B%B8%E5%85%B3/" rel="prev" title="MyBatis源码剖析 —— mapping 包相关">
                  <i class="fa fa-chevron-left"></i> MyBatis源码剖析 —— mapping 包相关
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2021/09/07/12306/" rel="next" title="12306究竟难在哪里">
                  12306究竟难在哪里 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2023</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">SongyangJi</span>
</div>
  <div class="powered-by">由 <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/muse/" rel="noopener" target="_blank">NexT.Muse</a> 强力驱动
  </div>

    </div>
  </footer>

  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>
  <div class="sidebar-dimmer"></div>
  <div class="back-to-top" role="button" aria-label="返回顶部">
    <i class="fa fa-arrow-up fa-lg"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


  
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/schemes/muse.js"></script><script src="/js/next-boot.js"></script>

  <script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.1/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous"></script>
<script src="/js/third-party/search/local-search.js"></script>





  





</body>
</html>
